import { BLOCKED_PAGES } from '../../constants/index';
import { isAliveIframe } from '../checkEnv';

export const postMessageInALiveIframe = (pageName, currentPage) => {
    // 判断是否在iframe中
    if (isAliveIframe) {
      // 将前往页面的title抛出给业务侧
      const postMessage = {
        name: 'page_name',
        value: pageName,
        showBack: BLOCKED_PAGES.includes(currentPage) ? false : true,
      }
      parent.postMessage(postMessage, window.location.origin);
    }
}